<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>

<body>
	<!-- 计算总成绩，按总成绩排名。统计各单科成绩第一名，输出其成绩与学号。
	

学号	语文	数学	英语	总成绩	备注
	1	 105	  62	 118
	2	 89	   78	  120
	3	 86	   64	  80
	4	78	   99	   91
	5	107.5	97	70
	6	112	  61	  92
	7	101	  79	 104
	8	71	   72	  105
	9	56	68	61
	10	98	83	77 -->
	<script>
		var data = [{
			sno: 1,
			chinese: 105,
			math: 62,
			english: 118,

		},
		{
			sno: 2,
			chinese: 89,
			math: 78,
			english: 120,

		},
		{
			sno: 3,
			chinese: 86,
			math: 64,
			english: 80,

		},
		{
			sno: 4,
			chinese: 78,
			math: 99,
			english: 91,

		},
		{
			sno: 5,
			chinese: 107.5,
			math: 97,
			english: 70,

		},
		{
			sno: 6,
			chinese: 112,
			math: 61,
			english: 92,

		},
		{
			sno: 7,
			chinese: 101,
			math: 79,
			english: 104,

		},
		{
			sno: 8,
			chinese: 71,
			math: 72,
			english: 105,

		},
		{
			sno: 9,
			chinese: 56,
			math: 68,
			english: 61,

		},
		{
			sno: 10,
			chinese: 93,
			math: 83,
			english: 77,

		}
		];
		var sum = 0;
		var maxChinese = 0;
		var maxChineseSno = 0;
		var maxMath = 0;
		var maxMathSno = 0;
		var maxEnglish=0;
		var maxEnglishSno=0;
		data.forEach(function(v){
			sum=v.chinese+v.math+v.english;
			// console.table("学号是"+v.sno+"同学,总成绩为"+sum );
			console.table(v.sno,sum );
		    if(v.chinese>maxChinese){
				maxChinese=v.chinese;
                maxChineseSno=v.sno; 
			}
			if(v.math>maxMath){
				maxMath=v.math;
				maxMathSno=v.sno;
			}
			if(v.english>maxEnglish){
				maxEnglish=v.english;
				maxEnglishSno=v.sno
			}
		})
		console.log("语文单科成绩是最高"+maxChinese+"学号是"+ maxChineseSno);
		console.log("数学单科成绩是最高"+maxMath+"学号是"+ maxMathSno);
		console.log("英语单科成绩是最高"+maxEnglish+"学号是"+maxEnglishSno);
	</script>
</body>
</html>